package com.youku.plugins.endcardV4New.view
{
   import flash.display.Sprite;
   import com.youku.interfaces.IEndCardV4New;
   import com.youku.plugins.PluginEventDispather;
   import com.youku.plugins.endcardV4New.model.data.PlayerVideoData;
   import com.youku.baseUI.BasePlayerButton;
   import flash.text.TextField;
   import com.youku.plugins.endcardV4New.model.data.PlayerSizeData;
   import com.youku.utils.AssetUtil;
   import com.youku.plugins.endcardV4New.EndCardFont;
   import flash.text.TextFieldAutoSize;
   import flash.events.MouseEvent;
   import com.youku.plugins.endcardV4New.EndCardEvent;
   
   public class Share extends Sprite implements IEndCardV4New
   {
      
      public function Share() {
         super();
      }
      
      private var _eventManager:PluginEventDispather;
      
      private var _playerVideoData:PlayerVideoData;
      
      private var _button:BasePlayerButton;
      
      private var _title:TextField;
      
      public function init(param1:Object = null, param2:PluginEventDispather = null, param3:PlayerSizeData = null) : void {
         this._playerVideoData = param1 as PlayerVideoData;
         this._eventManager = param2;
         this._button = AssetUtil.getStyleButton("EndCard_share_button");
         AssetUtil.restoreButtonSize(this._button);
         addChild(this._button);
         this._title = AssetUtil.getTextField(false);
         this._title.defaultTextFormat = EndCardFont.FONT_INTERACTION_COMMON;
         this._title.autoSize = TextFieldAutoSize.LEFT;
         this._title.text = "分享";
         this._title.x = 43;
         this._title.y = 11;
         this._button.addChild(this._title);
         this.changeSize(param3);
         this.addEvent();
      }
      
      private function set disable(param1:Boolean) : void {
         this._button.enabled = param1;
      }
      
      private function addEvent() : void {
         this._button.addEventListener(MouseEvent.CLICK,this.onButtonClick);
      }
      
      private function onButtonClick(param1:MouseEvent) : void {
         var _loc2_:EndCardEvent = new EndCardEvent(EndCardEvent.ENDCARD_SHARE_CLICK);
         this._eventManager.dispatchEvent(_loc2_);
      }
      
      private function removeEvent() : void {
         this._button.removeEventListener(MouseEvent.CLICK,this.onButtonClick);
      }
      
      public function changeSize(param1:PlayerSizeData = null) : void {
      }
      
      public function uninstall() : void {
         this.removeEvent();
         if(contains(this._button))
         {
            removeChild(this._button);
         }
         if(contains(this._title))
         {
            removeChild(this._title);
         }
      }
   }
}
